#include "town.h"

#include "items.h"


void Fishing()
{
	cItem iCollect;
	sint iChanceOfRain = 0;
	px.rng(iChanceOfRain, 100);
	px.clrscr();
	if(iChanceOfRain>89) // good fishing
	{
		px.pause("You got lucky today. Heavy rain means lotsa fish.\nPress enter to continue...");
		px.nl();
		px.rng(gInt);
		if(gInt>9) // 10-20 big fish with lots of meat, low exp, high value
		{
			// Tuna
			px.text("You caught a Tuna!");
			px.rng(gInt, 8);
			iCollect.setCollection(gInt);
			px.text("You got ",false);
			px.number(gInt,false);
			px.text(" meat, ", false);
			px.rng(gInt, 2);
			iCollect.setXpWorth(gInt);
			px.number(gInt,false);
			px.text(" experience and its worth ", false);
			px.rng(gInt, 5);
			iCollect.setValue(gInt);
			px.number(gInt,false);
			px.text(" gold.");

			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Tuna");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			

			// create the tuna item here and push it into the players inventory
		}
		else // 1-9 big fish with lots of exp, low value but high meat
		{
			// Alligator
			px.text("You caught a Alligator!");
			px.rng(gInt, 7);
			iCollect.setCollection(gInt);
			px.text("You got ",false);
			px.number(gInt,false);
			px.text(" meat, ", false);
			px.rng(gInt, 7);
			iCollect.setXpWorth(gInt);
			px.number(gInt,false);
			px.text(" experience and its worth ", false);
			px.rng(gInt, 3);
			iCollect.setValue(gInt);
			px.number(gInt,false);
			px.text(" gold.");
			
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Alligator");
			iCollect.setDesc("A prehistoric monster predator with razor sharp teeth.");

			
			// create the alligator item here and push it into the players inventory
		}
	}
	else // luck of the draw  of values should be 7 i.e. 3 xp, 2 meat, 2 value = 3 + 2 + 2 = 7 :D
	{
		px.text("You are going fishing today.");
		px.rng(gInt, 100);
		if(gInt<=20) // river trout 3 exp, 0 value, 4 meat
		{
			px.text("You caught a River Trout!");
			px.text("You got 4 meat, 3 experience and its worth no gold.");
			// create the river trout item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("River Trout");
			iCollect.setDesc("A common sight in your local river or non-stagnant pond.");
			iCollect.setValue(0);
			iCollect.setCollection(4);
			iCollect.setXpWorth(3);
		}
		else if (gInt>20&&gInt<=40) // pumpkin seed 3 exp, 4 value, 0 meat
		{
			px.text("You caught a Pumpkin Seed!");
			px.text("You got no meat, 3 experience and its worth 2 gold.");
			// create the pumpkin seed item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Pumpkin Seed");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(2);
			iCollect.setCollection(0);
			iCollect.setXpWorth(3);
		}
		else if (gInt>40&&gInt<=60) // rainbow salmon 1 exp, 3 value, 3 meat
		{
			px.text("You caught a Rainbow Salmon!");
			px.text("You got 3 meat, 1 experience and its worth 3 gold.");
			// create the rainbow salmon item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Rainbow Salmon");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(3);
			iCollect.setCollection(3);
			iCollect.setXpWorth(1);
		}
		else if (gInt>60&&gInt<=80) // catfish 2 exp, 3 value, 2 meat
		{
			px.text("You caught a Catfish!");
			px.text("You got 1 meat, 2 experience and its worth 3 gold.");
			// create the catfish item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Catfish");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(3);
			iCollect.setCollection(1);
			iCollect.setXpWorth(3);
		}
		else // big mouth bass 0 exp, 2 value, 4 meat
		{
			px.text("You caught a Big Mouth Bass!");
			px.text("You got 4 meat, 0 experience and its worth 2 gold.");
			// create the big mouth bass item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Big Mouth Bass");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(2);
			iCollect.setCollection(4);
			iCollect.setXpWorth(0);
		}
	}
	px.pause();
}


void Hunting()
{
	cItem iCollect;
	sint iChanceOfGoodGame;
	px.rng(iChanceOfGoodGame,100);
	px.clrscr();

	if(iChanceOfGoodGame>89) // good hunting
	{
		px.pause("You got lucky today. Blue skies and green grass means lotsa game.\nPress enter to continue...");
		px.nl();
		px.rng(gInt);
		if(gInt>9) // Wild boar with lots of meat and xp but low value
		{
			px.text("You caught a Wild Boar!");
			px.rng(gInt, 5);
			iCollect.setCollection(gInt);
			px.text("You got ",false);
			px.number(gInt,false);
			px.text(" meat, ", false);
			px.rng(gInt, 8);
			iCollect.setXpWorth(gInt);
			px.number(gInt,false);
			px.text(" experience and its worth ", false);
			px.rng(gInt, 2);
			iCollect.setValue(gInt);
			px.number(gInt,false);
			px.text(" gold.");
			// create the wild boar item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Wild Boar");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
		}
		else // Mountain lion with lots of value and xp but low meat
		{
			px.text("You caught a Mountain Lion!");
			px.rng(gInt, 2);
			iCollect.setCollection(gInt);
			px.text("You got ",false);
			px.number(gInt,false);
			px.text(" meat, ", false);
			px.rng(gInt, 2);
			iCollect.setXpWorth(gInt);
			px.number(gInt,false);
			px.text(" experience and its worth ", false);
			px.rng(gInt, 8);
			iCollect.setValue(gInt);
			px.number(gInt,false);
			px.text(" gold.");
			// create the mountain lion item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Mountain Lion");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");

		}
	}
	else // luck of the draw sum of values should be 7 i.e. 3 xp, 2 meat, 2 value = 3 + 2 + 2 = 7 :D
	{
		px.text("You are going hunting today.");
		px.rng(gInt,100);
		if(gInt <= 20) // squirrel 4 xp, 0 meat and 3 value
		{
			px.text("You caught a Squirrel!");
			px.text("You got no meat, 4 experience and its worth 3 gold.");
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Squirrel");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(3);
			iCollect.setCollection(0);
			iCollect.setXpWorth(4);
		}
		else if (gInt>20&&gInt<=40) // turkey 1 exp, 3 value, 3 meat
		{
			px.text("You caught a Turkey!");
			px.text("You got 4 meat, 1 experience and its worth 3 gold.");
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Turkey");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(3);
			iCollect.setCollection(4);
			iCollect.setXpWorth(1);
		}
		else if (gInt>40&&gInt<=60) // rabbit 2 exp, 4 value, 1 meat
		{
			px.text("You caught a Rabbit!");
			px.text("You got 1 meat, 2 experience and its worth 4 gold.");
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Rabbit");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(4);
			iCollect.setCollection(1);
			iCollect.setXpWorth(2);
		}
		else if (gInt>60&&gInt<=80) // frog 5 exp, 1 value, 2 meat
		{
			px.text("You caught a Frog!");
			px.text("You got 1 meat, 5 experience and its worth 1 gold.");
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Frog");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(1);
			iCollect.setCollection(1);
			iCollect.setXpWorth(5);
		}
		else // deer 0 exp, 2 value, 5 meat
		{
			px.text("You caught a 12-point Buck!");
			px.text("You got 5 meat, no experience and its worth 2 gold.");
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("12-point Buck");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(2);
			iCollect.setCollection(5);
			iCollect.setXpWorth(0);
		}
	}
	px.pause();
}

void Vegitation()
{
	cItem iCollect;
	sint iChanceOfRain = 0;
	px.rng(iChanceOfRain, 100);
	px.clrscr();
	if(iChanceOfRain>89) // good fishing
	{
		px.text("You start walking to your usual picking grounds, but upon your way");
		px.text("you spot a buck and track him to a clearing where he dashes away. Darn.");
		px.pause("But you found instead bushels of edibles.\nPress enter to continue...");
		px.nl();
		px.rng(gInt);
		if(gInt>9) // raspberries with lots of value and meat but low xp
		{
			px.text("You found juicy Raspberries!");
			px.rng(gInt, 8);
			iCollect.setCollection(gInt);
			px.text("You got ",false);
			px.number(gInt,false);
			px.text(" berries, ", false);
			px.rng(gInt, 2);
			iCollect.setXpWorth(gInt);
			px.number(gInt,false);
			px.text(" experience and its worth ", false);
			px.rng(gInt, 5);
			iCollect.setValue(gInt);
			px.number(gInt,false);
			px.text(" gold.");
			// create the raspberries item here and push it into the players inventory
		}
		else // grapes with lots of exp, medium meat but low value
		{
			px.text("You found plump Grapes!");
			px.rng(gInt, 5);
			iCollect.setCollection(gInt);
			px.text("You got ",false);
			px.number(gInt,false);
			px.text(" meat, ", false);
			px.rng(gInt, 8);
			iCollect.setXpWorth(gInt);
			px.number(gInt,false);
			px.text(" experience and its worth ", false);
			px.rng(gInt, 2);
			iCollect.setValue(gInt);
			px.number(gInt,false);
			px.text(" gold.");
			// create the grapes item here and push it into the players inventory
		}
	}
	else // luck of the draw  of values should be 7 i.e. 3 xp, 2 meat, 2 value = 3 + 2 + 2 = 7 :D
	{
		px.text("You mosey on over to your usual picking grounds.");
		px.rng(gInt, 100);
		if(gInt<=20) // blueberries 4 berries, 3 xp, 0 gold
		{
			px.text("You found a patch of giant Blueberries!");
			px.text("You got 4 berries, 3 experience and its worth no gold.");
			// create the blueberries item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Giant Blueberries");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(0);
			iCollect.setCollection(4);
			iCollect.setXpWorth(3);
		}
		else if (gInt>20&&gInt<=40) // watermelon 0 berries, 3 xp and 2 gold
		{
			px.text("You found a vine of ripe Watermelons!");
			px.text("You got no berries, 3 experience and its worth 2 gold.");
			// create the watermelon item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Ripe Watermelon");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(2);
			iCollect.setCollection(0);
			iCollect.setXpWorth(3);
		}
		else if (gInt>40&&gInt<=60) // bananas 3 meat, 1 xp, 3 gold
		{
			px.text("You found a bunch a green Bananas!");
			px.text("You got 3 bunches, 1 experience and its worth 3 gold.");
			// create the bananas item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Green Bananas");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(3);
			iCollect.setCollection(3);
			iCollect.setXpWorth(1);
		}
		else if (gInt>60&&gInt<=80) // cucumbers 2 pieces, 1 xp and 4 gold
		{
			px.text("You found a vine of huge cucumbers");
			px.text("You got 2 pieces, 1 experience and its worth 4 gold.");
			// create the cucumber item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Huge Cucumbers");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(4);
			iCollect.setCollection(2);
			iCollect.setXpWorth(1);
		}
		else // Potatoes 3 bushels, 1 xp and 3 gold
		{
			px.text("You found a vine of plump Potatoes!");
			px.text("You got 3 bushels, 1 experience and its worth 3 gold.");
			// create the potato item here and push it into the players inventory
			iCollect.setConsumable(true);
			iCollect.setType(food);
			iCollect.setName("Plump Potatoes");
			iCollect.setDesc("A large blue fin fish usually found in tropical areas.");
			iCollect.setValue(3);
			iCollect.setCollection(3);
			iCollect.setXpWorth(1);
		}
	}
	px.pause();
}
